package com.example.docmanagement.dto.response;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Builder;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;
import java.util.UUID;

/**
 * 用户响应 DTO
 */
@Data
@Builder
@Schema(description = "用户响应数据")
public class UserResponse {

    @Schema(description = "用户ID")
    private UUID id;

    @Schema(description = "邮箱")
    private String email;

    @Schema(description = "用户名")
    private String username;

    @Schema(description = "姓名")
    private String fullName;

    @Schema(description = "手机号")
    private String phone;

    @Schema(description = "头像URL")
    private String avatarUrl;

    @Schema(description = "个人简介")
    private String bio;

    @Schema(description = "用户状态")
    private String status;

    @Schema(description = "邮箱是否已验证")
    private Boolean emailVerified;

    @Schema(description = "邮箱验证时间")
    private LocalDateTime emailConfirmedAt;

    @Schema(description = "最后登录时间")
    private LocalDateTime lastSignInAt;

    @Schema(description = "最后登录IP")
    private String lastSignInIp;

    @Schema(description = "登录次数")
    private Integer signInCount;

    @Schema(description = "创建时间")
    private LocalDateTime createdAt;

    @Schema(description = "更新时间")
    private LocalDateTime updatedAt;

    @Schema(description = "所属角色")
    private RoleSummary role;

    @Schema(description = "额外权限ID列表")
    private List<Long> extraPermissionIds;

    @Schema(description = "原始应用元数据（JSON 字符串）")
    private String rawAppMetaData;

    @Schema(description = "原始用户元数据（JSON 字符串）")
    private String rawUserMetaData;

    @Schema(description = "软删除时间")
    private LocalDateTime deletedAt;

    @Data
    @Builder
    @Schema(description = "角色简要信息")
    public static class RoleSummary {
        @Schema(description = "角色ID", example = "1")
        private Long id;

        @Schema(description = "角色标识（英文名称）", example = "admin")
        private String name;

        @Schema(description = "角色显示名称（中文）", example = "系统管理员")
        private String displayName;
    }
}


